home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / src / lib / mg / mg.doc < prev   
Encoding:
Text File  |  1993-02-04  |  23.9 KB  |  674 lines

  1. $Id: mg.doc,v 1.14 1993/02/04 00:43:29 slevy Exp $
  2.  
  3.               MinneGraphics (MG)
  4.              The Geometry Center
  5.                   July 1991
  6.  
  7.          mbp, slevy, Sun Jul 21 15:16:25 1991
  8.  
  9. This document defines MG.  MG is a graphics library which provides a
  10. common interface for doing interactive 3D graphics on a variety of
  11. platforms.  The main intent is that it will be used with OOGL (Object
  12. Oriented Graphics Lanauge), but there is nothing OOGL-specific about
  13. MG, and conceivably other applications could use it as well.
  14.  
  15. MG is not meant to be as general or powerful as other 3D graphics
  16. lanuages such as GL, XGL, RenderMan, PHIGS, etc. --- rather it is
  17. meant to provide access to the most important operations common to all
  18. of these languages.  MG is deliberately simple. It is *not* an attempt
  19. to solve the 3D graphics standardization problem.  Until a widely
  20. accepted standard does emerge, MG is an attempt to insulate ourselves
  21. from the specifics of individual graphics lanuages, allowing us to
  22. write programs that will run under a variety of these languages.
  23.  
  24. MG consists of several parts: a common part, and a part for each
  25. device (language) on which it it implemented.  The library files are
  26. constructed so that each device-specific library includes the common
  27. part, so the application program only needs to link in the libraries
  28. corresponding to the devices it wants to use (there is no separate
  29. "common" library).
  30.  
  31. Any application program using MG should include the header file "mg.h".
  32.  
  33. The rest of this file contains a list of the MG procedures with a
  34. description of the call syntax and an explanation of what each
  35. procedure does.  This list is meant to be used both in writing
  36. MG application modules and in writing MG device-drivers.
  37.  
  38. Most MG procedures have several versions.  The following conventions
  39. are used in referring to them.
  40.  
  41. 1. application version
  42.    name convention: mgproc
  43.  
  44.     This is the version of the procedure which application
  45.     programs call.  In most cases the name "mgproc" is actually a
  46.     #define macro which expands to a function pointer which points
  47.     to the corresponding device-specific version of proc.
  48.     Application programs should only call these versions of
  49.     MG procedures (the one exception is mgdevice_XX, for which
  50.     there is only a device-specific version).
  51.  
  52. 2. common version
  53.    name convention: mg_proc
  54.  
  55.     This is a version of proc which performs operations,
  56.     frequently bookkeeping type things, common to all MG devices.
  57.     The device-specific version of proc may call the common
  58.     version to accomplish these operations.  For the details of
  59.     what the common mg_proc does, including information on when
  60.     the device-specific version should call it, see the
  61.     documentation of the source code for mg_proc in the mg/common
  62.     directory.
  63.  
  64.     The common procedures also serve as the "null device".
  65.     Before a device has been specified in an MG application
  66.     program, the application version of proc is a pointer
  67.     to the common procedure.  Running the program in this state
  68.     draws no graphics but accomplishes all other operations
  69.     associated with MG.
  70.  
  71. 3. device version
  72.    name convention: mgxx_proc, where xx = device (GL, XGL, etc).
  73.  
  74.     This is the version of proc specific to device xx.  It
  75.     accomplishes the actual graphics operations, and calls the
  76.     corresponding common routine if/when necessary to perform
  77.     common operations.
  78.  
  79.     To write a new MG device driver you must supply a version of
  80.     each device procedure for the new device.
  81.  
  82.  
  83. The call syntax of each of these versions of proc is identical; the
  84. prototypes below are given in terms of the application version.
  85.  
  86.  
  87.  
  88.       APPLICATION        COMMON               DEVICE
  89.         VERSION        VERSION               VERSION
  90.     -----------------    -------            ---------------
  91.  
  92. General control and
  93. informational procedures:
  94.  
  95.     mgbegin            mg_begin             NONE ??? (1)
  96.     mgend            mg_end               NONE ??? (1)
  97.     NONE            NONE             mgdevice_XX
  98.     mgsync            mg_sync              mgxx_sync
  99.     mgworldbegin        mg_worldbegin        mgxx_worldbegin
  100.     mgworldend        mg_worldend          mgxx_worldend
  101.     mgfeature        mg_feature           mgxx_feature
  102.  
  103. Procedures related to creating
  104. and modifying the graphics context:
  105.  
  106.     mgctxcreate        mg_ctxcreate          mgxx_ctxcreate
  107.     mgctxtcopy        mg_ctxcopy            NONE
  108.     mgctxdelete        mg_ctxdelete          mgxx_ctxdelete
  109.     mgctxselect        mg_ctxselect          mgxx_ctxselect
  110.     mgctxset        mg_ctxset             mgxx_ctxset
  111.     mgctxget        mg_ctxget             mgxx_ctxget
  112.     mgpushappearance    mg_pushappearance     mgxx_pushappearance
  113.     mgpopappearance        mg_popappearance      mgxx_popappearance
  114.     mgsetappearance        mg_setappearance      mgxx_setappearance
  115.     mgsetcamera        mg_setcamera          mgxx_setcamera
  116.     mgidentity        mg_identity           mgxx_identity
  117.     mgtransform        mg_transform          mgxx_transform
  118.     mgpushtransform        mg_pushtransform      mgxx_pushtransform
  119.     mgpoptransform        mg_poptransform       mgxx_poptransform
  120.     mgsettransform        mg_settransform        mgxx_settransform
  121.     mggettransform        mg_gettransform       mgxx_gettransform
  122.     mgreshapeviewport    mg_reshapeviewport    mgxx_reshapeviewport
  123.  
  124. Graphics primitives:
  125.  
  126.     mgpolygon        mg_polygon         mgxx_polygon
  127.     mgmesh            mg_mesh            mgxx_mesh
  128.     mgline            mg_line            mgxx_line
  129.     mgpolyline        mg_polyline        mgxx_polyline
  130.     mgpolylist        mg_polylist        mgxx_polylist
  131.     mgquads            mg_quads        mgxx_quads
  132.         mgbezier        mg_bezier        mgxx_bezier
  133.  
  134.  
  135. ========================================================================
  136.  
  137. /*-----------------------------------------------------------------------
  138.  * Function:    mgfeature
  139.  * Description: tests whether the current device has a particular feature
  140.  * Args:    feature:
  141.  * Returns:    a value that indicates something about the feature;
  142.  *          -1 means the feature is not present.
  143.  * Author:    slevy, mbp
  144.  * Date:    Thu Jul 18 20:29:34 1991
  145.  * Notes:    At present, only one feature is defined:
  146.  *              Feature        Returned Value
  147.  *            MGF_BEZIER        1 if mgbezier() supported, else -1.
  148.  *
  149.  *        Others are contemplated, for example:
  150.  *            MGF_ZBUFFER        Depth of Z buffer
  151.  *            MGF_BITPLANES    Number of bitplanes
  152.  *            MGF_DOUBLEBUFFER    1 for yes, -1 for no
  153.  *            etc etc etc
  154.  */
  155. int mgfeature(int feature)
  156.  
  157.  
  158. /*-----------------------------------------------------------------------
  159.  * Function:    mgctxcreate
  160.  * Description: create a graphics context
  161.  * Args:    a1, ...: list of (attribute, value) pairs, terminated by
  162.  *          MG_END
  163.  * Returns:    pointer to the new graphics context
  164.  * Author:    slevy, mbp
  165.  * Date:    Thu Jul 18 20:34:28 1991
  166.  * Notes:    The created context becomes the current context.  The
  167.  *        attributes specified in the list are set as though
  168.  *        they had been passed to mgctxset; see mgctxset
  169.  *        for an explanation of what attributes are allowed.
  170.  *
  171.  *        Device must be set, via a call to mgdevice_GL,
  172.  *        mgdevice_PS, etc, before creating a new context.  Once
  173.  *        created, a context is valid only for the device for which
  174.  *        it was created.
  175.  *
  176.  *        The value returned is a pointer to an opaque structure;
  177.  *        it should not be modified in any way.  The only thing
  178.  *        you can legitimately do with this pointer is pass it
  179.  *        to other MG procedures, such as mgctxselect.
  180.  *
  181.  *        The MG_SHOW attribute is set to 1 by default, which means
  182.  *        that (for relevant devices) the context's window becomes
  183.  *        visible on the screen when mgctxcreatec is called.
  184.  *        To prevent the window from appearing in the call to
  185.  *        mgctxcreate, set MG_SHOW to 0.  Then call mgctxset
  186.  *        to set MG_SHOW to 1 to make the window appear later.
  187.  *
  188.  *        Note: a1 is simply the first attribute in the list of
  189.  *        (attribute, value) pairs.  It is listed as a separate
  190.  *        argument because of the way stdarg works.
  191.  */
  192. mgcontext *mgctxcreate(a1, ... /*, MG_END */)
  193.  
  194. /*-----------------------------------------------------------------------
  195.  * Function:    mgctxcopy
  196.  * Description:    copy one context to another
  197.  * Args:    *src: the source context
  198.  *        *dst: the destination context
  199.  * Returns:    nothing
  200.  * Author:    mbp
  201.  * Date:    Mon Jul 22 11:01:32 1991
  202.  * Notes:    Everything associated with the source context
  203.  *        is copied into the destination context, EXCEPT the
  204.  *        device setting.
  205.  *
  206.  *        This is a shallow copy --- ctx attributes which are
  207.  *        pointers (e.g. the camera and window pointers) are
  208.  *        copied as pointers, so that those attributes in dest
  209.  *        point to the same structures as the corresponding src
  210.  *        attributes.
  211.  *
  212.  *        There is no device version of mgctxcopy.
  213.  */
  214. mgctxcopy(mgcontext *src, mgcontext *dst)
  215.  
  216. /*-----------------------------------------------------------------------
  217.  * Function:    mgctxdelete
  218.  * Description: delete a context
  219.  * Args:        ctx: pointer to the context to delete
  220.  * Returns:     nothing
  221.  * Author:      slevy, mbp
  222.  * Date:        Sun Jul 21 15:33:07 1991
  223.  * Notes:       ctx should be the pointer returned by mgctxcreate
  224.  *              when the context was created.  This procedure frees up
  225.  *              all space associated with ctx.  After
  226.  *              mgctxdelete(ctx), ctx will be an invalid pointer.
  227.  */
  228. void mgctxdelete(mgcontext *ctx)
  229.  
  230. /*-----------------------------------------------------------------------
  231.  * Function:    mgctxset
  232.  * Description: set some attributes in the current context
  233.  * Args:    a1, ...: list of (attribute, value) pairs, terminated by MG_END
  234.  * Returns:    nothing
  235.  * Author:    slevy, mbp
  236.  * Date:    Fri Jul 19 15:50:46 1991
  237.  * Notes:    Attributes are documented in the file mg.attr.
  238.  *        Note: a1 is simply the first attribute in the list
  239.  *        of (attribute, value) pairs.   It is listed as a
  240.  *        separate argument because of the way stdarg works.
  241.  *        The list of attributes MUST end with MG_END.
  242.  */
  243. void mgctxset(a1, ... /*, MG_END */)
  244.  
  245. /*-----------------------------------------------------------------------
  246.  * Function:    mgctxget
  247.  * Description: get the value of an attribute in the current context
  248.  * Args:    attr: the attribute to get
  249.  *        valueptr: pointer to location to write value to
  250.  * Returns:    number of bytes written to address valueptr; 0 means
  251.  *          invalid attr
  252.  * Author:    slevy, mbp
  253.  * Date:    Fri Jul 19 16:26:32 1991
  254.  * Notes:    valueptr should be the address of an object of the type
  255.  *        associated with the attribute attr; the object at
  256.  *        that address will be overwritten with the value in
  257.  *        the current context.  See mg.attr for a list of
  258.  *        attributes.
  259.  */
  260. int mgctxget(int attr, void* valueptr)
  261.  
  262. /*-----------------------------------------------------------------------
  263.  * Function:    mgctxselect
  264.  * Description: Set the current graphics context to ctx
  265.  * Args:    ctx: ptr to the context to make current
  266.  * Returns:    ctx, or NULL if unsuccessful
  267.  * Author:    slevy, mbp
  268.  * Date:    Fri Jul 19 11:48:13 1991
  269.  * Notes:    Does not copy *ctx --- just sets the internal pointer
  270.  *        _mgc to ctx, and calls any device-specific procedures
  271.  *        neccessary to bring the device into the state
  272.  *        corresponding to context *ctx.
  273.  *        Also changes the current device to be the device
  274.  *        associated with *ctx.
  275.  */
  276. int mgctxselect(mgcontext *ctx)
  277.  
  278. /*-----------------------------------------------------------------------
  279.  * Function:    mgsync
  280.  * Description: Insures that all mg graphics operations have been sent to
  281.  *          the device, and instructs the device to process them
  282.  * Args:    (none)
  283.  * Returns:    nothing
  284.  * Author:    slevy, mbp
  285.  * Date:    Fri Jul 19 12:14:09 1991
  286.  * Notes:    The idea behind mgsync is that it could be used,
  287.  *        for example, to guarantee (in singlebuffer mode)
  288.  *        that everything that has
  289.  *        been drawn so far is actually visible in the window.
  290.  *        It might also be necessary for telling mg and/or the
  291.  *        device to flush any internal buffering of graphics
  292.  *        operations.
  293.  *
  294.  *        mgsync is called implicitly by mgworldend.
  295.  */
  296. void mgsync()
  297.  
  298. /*-----------------------------------------------------------------------
  299.  * Function:    mgworldbegin
  300.  * Description: Prepare to draw in the current context
  301.  * Args:    (none)
  302.  * Returns:    nothing
  303.  * Author:    slevy, mbp
  304.  * Date:    Fri Jul 19 12:49:12 1991
  305.  * Notes:    mgworldbegin must be called before any mg drawing commands.
  306.  *        It erases the current window to the background color and
  307.  *        clears any internal (to the device) records associated with
  308.  *        drawing.  Also interprets the current camera setting; all
  309.  *        graphics operations after mgworldbegin and before the next
  310.  *        mgworldend will be displayed using this camera setting.
  311.  *
  312.  *        The process of drawing an image on the current window
  313.  *        is bracketed by calls to mgworldbegin and mgworldend:
  314.  *            mgworldbegin();
  315.  *            draw draw draw;
  316.  *            mgworldend();     <-- image is complete here
  317.  */
  318. void mgworldbegin()
  319.  
  320.  
  321. /*-----------------------------------------------------------------------
  322.  * Function:    mgworldend
  323.  * Description: end the group of graphics operations begun with
  324.  *          mgworldbegin
  325.  * Args:    (none)
  326.  * Returns:    nothing
  327.  * Author:    slevy, mbp
  328.  * Date:    Fri Jul 19 13:01:00 1991
  329.  * Notes:    Guarantees that all operations done since mgworldbegin
  330.  *        become visible.     In doublebuffer mode, this involves
  331.  *        swapping the buffers.  Implicitly calls mgsync.
  332.  *        Some devices might buffer graphics operations, and only
  333.  *        interpret them when mgworldend is called.
  334.  */
  335. void mgworldend()
  336.  
  337. /*-----------------------------------------------------------------------
  338.  * Function:    mgreshapeviewport
  339.  * Description: adjust internal window & camera
  340.  * Args:    (none)
  341.  * Returns:    nothing
  342.  * Author:    slevy, mbp
  343.  * Date:    Fri Jul 19 13:11:29 1991
  344.  * Notes:    Intended for use in window systems where the user may
  345.  *        dynamically reshape, resize, or move the window.  Causes
  346.  *        the window (MgWindow) size and position, and the camera
  347.  *        aspect ratio associated with the current context to be
  348.  *        updated to reflect the actual shape and size of the window.
  349.  */
  350. void mgreshapeviewport()
  351.  
  352. /*-----------------------------------------------------------------------
  353.  * Function:    mgidentity
  354.  * Description: sets the current context's object xform to I
  355.  * Args:    (none)
  356.  * Returns:    nothing
  357.  * Author:    slevy, mbp
  358.  * Date:    Fri Jul 19 13:19:43 1991
  359.  */
  360. void mgidentity()
  361.  
  362.  
  363. /*-----------------------------------------------------------------------
  364.  * Function:    mgtransform
  365.  * Description: mult (on the left) the current object xform by T
  366.  * Args:    T
  367.  * Returns:    nothing
  368.  * Author:    slevy, mbp
  369.  * Date:    Fri Jul 19 13:21:40 1991
  370.  * Notes:    Suppose that before mgtransform is called, the
  371.  *        current transform is A, so that object row vector v
  372.  *        is mapped to v A.  Then after mgtransform(T),
  373.  *        v will be mapped to v T A.
  374.  *
  375.  *        Note that this means that Euclidean translations
  376.  *        appear in the 4th row of the transform matrix
  377.  *        (rather than in the 4th column).
  378.  *
  379.  *        [This differs from the old mg convention,
  380.  *        so old programs may need to be changed.  However
  381.  *        the new convention matches the ASCII format we use
  382.  *        for matrices, and also matches the internal formats
  383.  *        used by SGI, Sun, and QuickRenderman.]
  384.  */
  385. void mgtransform(const Transform T)
  386.  
  387. /*-----------------------------------------------------------------------
  388.  * Function:    mgpushtransform
  389.  * Description: Push a copy of the current xform onto the current
  390.  *          context's xform stack
  391.  * Args:    (none)
  392.  * Returns:    the new depth of the stack ???
  393.  * Author:    slevy, mbp
  394.  * Date:    Fri Jul 19 13:30:24 1991
  395.  * Notes:    before    after
  396.  *          A      A    <-- top
  397.  *          B      A
  398.  *          C      B
  399.  *              C
  400.  *
  401.  *        Stack might have limited depth --- usually depends on the
  402.  *        device.
  403.  */
  404. int mgpushtransform()
  405.  
  406. /*-----------------------------------------------------------------------
  407.  * Function:    mgpoptransform
  408.  * Description: Pop the current context's xform stack
  409.  * Args:    (none)
  410.  * Returns:    the new depth of the stack ????
  411.  * Author:    slevy, mbp
  412.  * Date:    Fri Jul 19 13:39:04 1991
  413.  */
  414. int mgpoptransform()
  415.  
  416. /*-----------------------------------------------------------------------
  417.  * Function:    mggettransform
  418.  * Description: set the current context's current xform
  419.  * Args:    T: the xform
  420.  * Returns:    nothing
  421.  * Author:    slevy, mbp
  422.  * Date:    Fri Jul 19 13:44:18 1991
  423.  */
  424. void mgsettransform(Transform T)
  425.  
  426.  
  427. /*-----------------------------------------------------------------------
  428.  * Function:    mggettransform
  429.  * Description: get the current context's current xform
  430.  * Args:    T: the xform
  431.  * Returns:    the depth of the xform stack ????
  432.  * Author:    slevy, mbp
  433.  * Date:    Fri Jul 19 13:44:18 1991
  434.  * Notes:    The current xform is the one on the top of the stack.
  435.  */
  436. int mggettransform(Transform T)
  437.  
  438. /*-----------------------------------------------------------------------
  439.  * Function:    mgpushappearance
  440.  * Description: Push a copy of the current attr onto the current
  441.  *          context's appearance stack
  442.  * Args:    (none)
  443.  * Returns:    the new depth of the appearance stack ????
  444.  * Author:    slevy, mbp
  445.  * Date:    Fri Jul 19 13:45:19 1991
  446.  * Notes:    Like mgpushtransform, but works with the appearance stack
  447.  *        instead.
  448.  */
  449. int mgpushappearance()
  450.  
  451. /*-----------------------------------------------------------------------
  452.  * Function:    mgpopappearance
  453.  * Description: Pop the current context's appearance stack
  454.  * Args:    (none)
  455.  * Returns:    the new depth of the stack ????
  456.  * Author:    slevy, mbp
  457.  * Date:    Fri Jul 19 13:39:04 1991
  458.  */
  459. int mgpopappearance()
  460.  
  461. /*-----------------------------------------------------------------------
  462.  * Function:    mgsetappearance
  463.  * Description: merge or set current Appearance
  464.  * Args:    app: Appearance to merge or copy
  465.  *        mergeflag: copy or merge app into current Appearance?
  466.  * Returns:    nothing
  467.  * Author:    slevy, mbp
  468.  * Date:    Fri Jul 19 13:55:15 1991
  469.  * Notes:    If mergeflag==MG_SET, sets the current Appearance to
  470.  *        exactly match *app.  If mergelfag==MG_MERGE, sets the current
  471.  *        Appearance to the union of itself with *app.
  472.  *        For fields for which both the current Appearance
  473.  *        and *app have values, *app takes precedence, unless
  474.  *        the override bit is set for that field in the
  475.  *        current Appearance.
  476.  */
  477. void mgsetappearance(Appearance* app, int mergeflag)
  478.  
  479.  
  480. /*-----------------------------------------------------------------------
  481.  * Function:    mgsetcamera
  482.  * Description: set the current camera
  483.  * Args:    cam:
  484.  * Returns:    nothing
  485.  * Author:    slevy, mbp
  486.  * Date:    Fri Jul 19 14:06:29 1991
  487.  * Notes:    New camera will not actually be used until next
  488.  *          mgworldbegin.
  489.  */
  490. int mgsetcamera(Camera* cam)
  491.  
  492. /*-----------------------------------------------------------------------
  493.  * Function:    mgpolygon
  494.  * Description: draw a polygon
  495.  * Args:    nv: number of vertices
  496.  *        *v: array of nv vertices
  497.  *        nn: number of normals (should be either 0, 1, or nv)
  498.  *        *n: array of nn normals (ignored if nn==0)
  499.  *        nc: number of colors (should be either 0, 1, or nv)
  500.  *        *c: array of nc ColorA's (ignored if nc==0)
  501.  * Returns:    nothing
  502.  * Author:    slevy, mbp
  503.  * Date:    Fri Jul 19 16:41:24 1991
  504.  */
  505. void mgpolygon(int nv, Point3 *v, int nn, Point3 *n, int nc,ColorA *c)
  506.  
  507. /*-----------------------------------------------------------------------
  508.  * Function:    mgmesh
  509.  * Description: draw a mesh
  510.  * Args:    wrap: either MM_NOWRAP for no wrapping
  511.  *          or MM_UWRAP for wrapping in the u direction (cylinder)
  512.  *          or MM_VWRAP for wrapping in the v direction (cylinder)
  513.  *          or MM_UWRAP+MM_VWRAP for wrapping in both dirs (torus)
  514.  *        nu: number of vertices in the u direction
  515.  *        nv: number of vertices in the v direction
  516.  *        p: array of nu*nv vertices in v-major order (u index
  517.  *          increases fastest)
  518.  *        n: array of nu*nv normals (same order as *p), or NULL
  519.  *        c: array of nu*nv ColorA's (same order as *p), or NULL
  520.  * Returns:    nothing
  521.  * Author:    slevy, mbp
  522.  * Date:    Fri Jul 19 16:44:57 1991
  523.  * Notes:    if n is NULL, normals are not supplied to the device.
  524.  *        if c is NULL, then the color settings in the current
  525.  *          default Appearance apply.
  526.  */
  527. void mgmesh(int wrap,int nu,int nv,Point3 *p,Point3 *n,ColorA *c)
  528.  
  529.  
  530. /*-----------------------------------------------------------------------
  531.  * Function:    mgline
  532.  * Description: draws a line
  533.  * Args:    *p1: first endpoint of line
  534.  *        *p2: second endpoint of line
  535.  * Returns:    nothing
  536.  * Author:    slevy, mbp
  537.  * Date:    Fri Jul 19 16:54:50 1991
  538.  */
  539. void mgline(Point3 *p1, Point3 *p2)
  540.  
  541.  
  542. /*-----------------------------------------------------------------------
  543.  * Function:    mgpolyline
  544.  * Description: draws a polyline
  545.  * Args:    nv: number of vertices
  546.  *        *verts: array of nv vertices
  547.  *        nc: number of colors (should be 0, 1, or nv)
  548.  *        *colors: array of nc colors
  549.  *        flags: bit-encoded:
  550.  *           flags&1 indicates that this polyline is a closed curve;
  551.  *            an extra vector should be drawn connecting the
  552.  *            first and last points.
  553.  *        Other bits are available as hints the mg driver may use
  554.  *        to optimize the work done in drawing:
  555.  *           flags&2 indicates that this is not the first of a
  556.  *            batch of related polylines.  It might be sufficient
  557.  *            to initialize the drawing color for only the first
  558.  *            polyline in a batch; also, if the driver handles
  559.  *            displacing lines closer to the eye, then the transform
  560.  *            might be pushed before the first polyline of a batch
  561.  *            and popped after the last one.
  562.  *           flags&4 indicates that this is not the last of a
  563.  *            batch of related polylines.
  564.  * Returns:    nothing
  565.  * Author:    slevy, mbp
  566.  * Date:    Fri Jul 19 16:56:33 1991
  567.  */
  568. void mgpolyline(int nv, Point3 *verts, int nc, ColorA *colors, int flags)
  569.  
  570.  
  571. /*-----------------------------------------------------------------------
  572.  * Function:    mgpolylist
  573.  * Description: draws a PolyList
  574.  * Args:    npolys: number of Poly structures (one per polygon)
  575.  *        *polys: array of Poly structures from polylist.h.
  576.  *        flags: indicates which Poly & Vertex fields are valid;
  577.  *            bitwise union of PL_HAS{P,V}{N,COL} from polylist.h.
  578.  * Returns:    nothing
  579.  * Author:    slevy
  580.  * Date:    Mon Aug 19 15:16:44 CDT 1991
  581.  */
  582. void mgpolylist(int npolys, Poly *polys, int flags)
  583.  
  584. /*-----------------------------------------------------------------------
  585.  * Function:    mgquads
  586.  * Description: draws an array of Quads
  587.  * Args:    nquads: number of Poly structures (one per polygon)
  588.  *        *v: array of 4*nquads HPoint3's, the quads' vertices
  589.  *        *n: array of 4*nquads Point3's, their normals - or NULL
  590.  *        *c: array of 4*nquads ColorA's, their colors - or NULL
  591.  * Returns:    nothing
  592.  * Author:    slevy
  593.  * Date:    Mon Jul 17 23:16:20 CDT 1992
  594.  * Note:    This routine was added to optimize quad drawing.
  595.  */
  596. void mgquads(int nquads, HPoint3 *v, Point3 *n, ColorA *c)
  597.  
  598. /*-----------------------------------------------------------------------
  599.  * Function:    mgbezier
  600.  * Description: draws a bezier for those drivers which support it
  601.  * Args:    degree_u: degree in u direction
  602.  *        degree_v: degree in v direction
  603.  *        dimension: dimension
  604.  *        *controlPoints: array of control points
  605.  *              *txmapst: array of 4 (s,t) float pairs for texture map
  606.  *                coordinates for each corner of map
  607.  *        *colors: array of 4 ColorA structs or NULL
  608.  * Returns:    nothing
  609.  * Author:    wisdom (from munzners older code)
  610.  * Date:    Sat Sep 19 16:37:08 CDT 1992
  611.  * Notes:    Currently, the bezier is drawn blah blah
  612.  *        For those drivers which do not support beziers, the
  613.  *        bezier is diced and drawn as a mesh (common code default).
  614.  */
  615. void mgbezier(int degree_u, int degree_v, int dimension,
  616.           float *ControlPoints, float *txmapst, ColorA *colors)
  617.  
  618. /*-----------------------------------------------------------------------
  619.  * Function:    mgbegin
  620.  * Description: intialize MG
  621.  * Args:    (none)
  622.  * Returns:    nothing
  623.  * Author:    slevy, mbp
  624.  * Date:    Fri Jul 19 18:27:39 1991
  625.  * Notes:    Must be called exactly once, before any other mg
  626.  *          functions
  627.  */
  628. mgbegin()
  629.  
  630. /*-----------------------------------------------------------------------
  631.  * Function:    mgdevice_XX
  632.  * Description: select device xx
  633.  * Args:    (none)
  634.  * Returns:    nothing
  635.  * Author:    slevy, mbp
  636.  * Date:    Fri Jul 19 18:28:52 1991
  637.  * Notes:    Must be called after mgbegin and before mgcreatecontext.
  638.  *        If the current context is for a device other than xx,
  639.  *        it is de-selected.
  640.  *        See mg.h for list of valid devices allowed for xx.
  641.  */
  642. mgdevice_XX()
  643.  
  644. /*-----------------------------------------------------------------------
  645.  * Function:    mgend
  646.  * Description: shut down MG
  647.  * Args:    (none)
  648.  * Returns:    nothing
  649.  * Author:    slevy, mbp
  650.  * Date:    Fri Jul 19 18:31:34 1991
  651.  * Notes:    Call once after all other mg calls.
  652.  */
  653. mgend()
  654.  
  655.  
  656. ===========================================================================
  657.  
  658. (1) should we go ahead and be systematic and have mgxx_begin
  659. and mgxx_end and decree that each should call the
  660. common routine of the same name? (device begin/end inside
  661. common begin/end).
  662.  
  663. Done:
  664.  
  665. renamed        mgcopycontext    to    mgctxcopy
  666.         mgselectcontext to    mgctxselect
  667.  
  668.         mgsetAp        to    mgsetappearance
  669.         mgsetCam    to    mgsetcamera
  670.  
  671. added MG_SET and MG_MERGE for merge flag to setappearance.  Too much
  672. confusion over whether 0 or 1 means set or merge!!
  673.  
  674.